<?
class userModel extends iMVC_Model{

   public $_table='user'; 
   public $_pk='user_id';
   public $a=1;

   /*
    *验证账号密码
    *
    */
   public function checkPass($name,$pass){
   
        $reader=$this->db->getDbReader();
        $sql="select * from $this->_table where user_name='$name' and user_pass='$pass'";
        $res=$reader->readByQuery($sql);

        if($res!=null){

            $this->properties=array_merge($this->properties,$res[0]);

            return true;
        }
        else{
            return false; 
        
        }
   
   
   }
   //检查用户名是否存在,存在返回true;
   public function checkNameExist($name){
   
        $reader=$this->db->getDbReader();
        $sql="select * from $this->_table where user_name='$name'";
        $res=$reader->readByQuery($sql);
   
        if($res!=null){

            return true;
        }
        else{
            return false; 
        
        }
   }
  //返回info组 
   public function getInfo(){
   
        $info=new infoModel();
        $reader=$this->db->getDbReader();
        $sql="select * from $info->_table where user_id=$this->user_id";
        $res=$reader->readByQuery($sql);
        if($res!=null){
            return $res;
        }
        else{
            return false; 
        }
   
   
   }
//返回ads组 
   public function getAds(){
   
        $ads=new adsModel();
        $reader=$this->db->getDbReader();
        $sql="select * from $ads->_table where user_id=$this->user_id";
        $res=$reader->readByQuery($sql);
        if($res!=null){
            return $res;
        }
        else{
            return false; 
        }
   
   
   }







}

